﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using YY.Common;
using WebApp.BaseDataSvc;
using System.Text;
using System.Web.Services;
using Yogesh.ExcelXml;
using System.Data;
using System.Collections;
using System.Web.Script.Serialization;

namespace WebApp
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class ExportWTS : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            HttpResponse contextResponse = context.Response;
            contextResponse.Clear();
            contextResponse.Buffer = true;
            var dataType = context.Request.Params["DataType"];
            switch (dataType)
            {
                case "WTS":
                    string excelName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                    contextResponse.Charset = "GB2312"; //设置了类型为中文防止乱码的出现 
                    contextResponse.AppendHeader("Content-Disposition", String.Format("attachment;filename={0}", excelName)); //定义输出文件和文件名
                    //contextResponse.AppendHeader("Content-Length", content.Length.ToString());
                    contextResponse.ContentEncoding = Encoding.Default;
                    contextResponse.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。 
                    var orderId = Convert.ToInt32(context.Request.Params["OrderId"]);
                    exportWTS(orderId, contextResponse);
                    break;
                case "Bill":
                    var sDate = Convert.ToDateTime(context.Request.Params["SDate"]);
                    var eDate = Convert.ToDateTime(context.Request.Params["EDate"]);
                    var target = Convert.ToInt32(context.Request.Params["Target"]);
                    bool export = false;
                    if (!string.IsNullOrEmpty(context.Request.Params["Export"]))
                        export = Convert.ToBoolean(context.Request.Params["Export"]);
                    var feeType = (EnumCommon.FeeType)Enum.Parse(typeof(EnumCommon.FeeType), context.Request.Params["FeeType"]);
                    getBill(contextResponse, sDate, eDate, feeType, target, export);
                    break;
                default:
                    break;
            }
            contextResponse.End();
        }

        /// <summary>
        /// 输出委托书
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="contextResponse"></param>
        void exportWTS(int orderId, HttpResponse contextResponse)
        {
            ExcelXmlWorkbook book = new ExcelXmlWorkbook();
            BaseDataSvc.BaseDataClient BaseDataProxy = new BaseDataClient();
            string rtn = string.Empty;
            try
            {
                BaseDataProxy.Open();
                var trailer = BaseDataProxy.GetTrailer(orderId);
                var order = BaseDataProxy.GetOrder(orderId);

                if (trailer == null | order == null)
                    return;
                TB_Options o = BaseDataProxy.GetOption(trailer.agent);
                TB_User op = BaseDataProxy.GetUser(order.agent);
                BaseDataProxy.Close();

                string tcClientName = string.Empty;

                if (o != null)
                    tcClientName = o.name;

                string deadLineTime = string.Empty;
                if (trailer.deadline.HasValue)
                    deadLineTime = trailer.deadline.Value.ToString("g");

                string charge = string.Empty;
                if (trailer.charge.HasValue)
                    charge = trailer.charge.Value.ToString();



                book.Properties.Author = "盈泓";
                Worksheet sheet = book[0];
                sheet.Name = "拖车委托书";

                // More on this in documentation
                //sheet.FreezeTopRows = 3;

                // and this too...
                sheet.PrintOptions.Orientation = PageOrientation.Landscape;
                sheet.PrintOptions.SetMargins(0.5, 0.4, 0.5, 0.4);

                // This is the actual code which sets out the cell values
                // Note again, that we don't declare any instance at all.
                // All the work is done by the library.
                // Index operator takes first value as column and second as row.

                AlignmentOptions al = new AlignmentOptions();
                al.Horizontal = HorizontalAlignment.Center;
                al.Vertical = VerticalAlignment.Center;

                AlignmentOptions al1 = new AlignmentOptions();
                al1.Horizontal = HorizontalAlignment.Left;
                al1.Vertical = VerticalAlignment.Center;

                XmlStyle style1 = new XmlStyle();
                style1.Font.Bold = true;
                style1.DisplayFormat = DisplayFormatType.Text;
                style1.Font.Size = 30;
                style1.Font.Name = "宋体";
                style1.Alignment = al;


                XmlStyle style2 = new XmlStyle();
                style2.Font.Bold = true;
                style2.DisplayFormat = DisplayFormatType.Text;
                style2.Font.Size = 20;
                style2.Font.Name = "宋体";
                style2.Alignment = al;

                XmlStyle style3 = new XmlStyle();
                style3.Font.Bold = true;
                style3.DisplayFormat = DisplayFormatType.Text;
                style3.Font.Size = 15;
                style3.Font.Name = "宋体";
                style3.Alignment = al1;

                sheet[0, 0].Value = "广州市盈洋货运代理有限公司";
                sheet[0, 0].Style = style1;

                sheet[0, 1].Value = "";
                sheet[0, 1].Style = style3;

                sheet[0, 2].Value = "派车委托书";
                sheet[0, 2].Style = style2;

                sheet[0, 3].Value = "致" + tcClientName + " " + trailer.stowageContact;
                sheet[0, 3].Style = style3;

                sheet[0, 4].Value = "兹委托贵公司派车到以下地点装货，资料如下：";
                sheet[0, 4].Style = style3;

                sheet[0, 5].Value = "1、订舱号：" + order.cCode;
                sheet[0, 5].Style = style3;

                sheet[0, 6].Value = "到厂装货时间：" + deadLineTime;
                sheet[0, 6].Style = style3;

                sheet[0, 7].Value = "2、装货地点：" + trailer.address;
                sheet[0, 7].Style = style3;

                sheet[0, 8].Value = "3、联系人：" + trailer.stowageContact;
                sheet[0, 8].Style = style3;

                sheet[0, 9].Value = "4、柜型：" + trailer.specs;
                sheet[0, 9].Style = style3;

                sheet[0, 10].Value = "5、运费：" + charge;
                sheet[0, 10].Style = style3;

                sheet[0, 11].Value = "6、备注：" + trailer.memo;
                sheet[0, 11].Style = style3;

                sheet[0, 12].Value = "7、（请准时到达。柜号司机资料麻烦到时发到15018476677 谢谢！）";
                sheet[0, 12].Style = style3;

                sheet[0, 13].Value = "";
                sheet[0, 13].Style = style3;

                sheet[0, 14].Value = "操作人员：" + op.userName;
                sheet[0, 14].Style = style3;

                sheet[0, 15].Value = "我司单号：" + order.code;
                sheet[0, 15].Style = style3;

                sheet[0, 16].Value = "座机号：020-28945185";
                sheet[0, 16].Style = style3;

                sheet[0, 17].Value = "手机：" + op.tel;
                sheet[0, 17].Style = style3;

                sheet[0, 18].Value = "传真号：020-32372253";
                sheet[0, 18].Style = style3;

                sheet[0, 19].Value = "日期：" + DateTime.Now.ToString("yyyy-MM-dd");
                sheet[0, 19].Style = style3;

                //"2、装货地点：" + trailer.address
                sheet.Columns(0).Width = 543;


                // no extension is added if not present
                //string outputFile = "Outstanding File.xml";

                book.Export(contextResponse.OutputStream);
                //book.Export(outputFile);




            }
            catch (Exception ex)
            {
                throw ex;
            }
            //return rtn;
        }

        /// <summary>
        /// 获取账单
        /// </summary>
        /// <param name="contextResponse"></param>
        /// <param name="sDate"></param>
        /// <param name="eDate"></param>
        /// <param name="feeType"></param>
        /// <param name="target"></param>
        /// <param name="export"></param>
        void getBill(HttpResponse contextResponse, DateTime sDate, DateTime eDate, EnumCommon.FeeType feeType, int target, bool export)
        {

            BaseDataSvc.BaseDataClient BaseDataProxy = new BaseDataClient();
            string rtn = string.Empty;
            try
            {
                BaseDataProxy.Open();
                var dt = BaseDataProxy.GetOrderBill(target, sDate, eDate, (int)feeType);

                if (dt != null && dt.Rows.Count > 0)
                {
                    IEnumerable<TB_Options> os = BaseDataProxy.FindOptions(EnumCommon.OptionType.费目类型.ToString(), null, null);
                    foreach (DataRow dr in dt.Rows)
                    {

                        int orderId = Convert.ToInt32(dr["orderId"]);
                        TB_Case[] cases = BaseDataProxy.GetCases(orderId);
                        if (cases != null)
                        {
                            var models = from m in cases select m.model;
                            var codes = from m in cases select m.code;
                            var titles = from m in cases select m.title;
                            dr.SetField<string>("箱型", dr.Field<string>("箱型") + string.Join("\n", models.ToArray<string>()));
                            dr.SetField<string>("箱号", dr.Field<string>("箱号") + string.Join("\n", codes.ToArray<string>()));
                            dr.SetField<string>("封号", dr.Field<string>("封号") + string.Join("\n", titles.ToArray<string>()));
                        }

                        IEnumerable<TB_Fee> fees = BaseDataProxy.GetFees(orderId);

                        decimal total = 0;
                        if (fees != null)
                        {
                            fees = fees.Where(p => p.feeType == (int)feeType && p.isVerify);

                            if (EnumCommon.FeeType.应付 == feeType)
                                fees = fees.Where(p => p.target == target);

                            var q = from f in fees.Where(p => p.feeType == (int)feeType && p.isVerify)
                                    join o in os on f.item equals o.id
                                    select (o.name + "：" + f.amount.ToString());

                            dr.SetField<string>("费用", dr.Field<string>("费用") + string.Join("\n", q.ToArray<string>()));
                            total = fees.Sum(s => s.amount);
                            dr.SetField<decimal>("总额", total);
                        }
                    }
                    dt.AcceptChanges();
                    if (!export)
                    {
                        contextResponse.ContentType = "application/json";
                        contextResponse.Cache.SetNoStore();
                        //Hashtable ht = new Hashtable();
                        //ht.Add("total", dt.Rows.Count);
                        //ht.Add("rows", dt);
                        //string jsonStr = new JavaScriptSerializer().Serialize(ht);
                        string jsonStr = "{\"total\":" + dt.Rows.Count.ToString() + ",\"rows\":" + WebCommon.DataTableToJson(dt) + "}";
                        contextResponse.Write(jsonStr);
                    }
                    else
                    {
                        ExcelXmlWorkbook book = new ExcelXmlWorkbook();
                        contextResponse.Charset = "GB2312"; //设置了类型为中文防止乱码的出现 
                        contextResponse.AppendHeader("Content-Disposition", String.Format("attachment;filename={0}", "账单.xls")); //定义输出文件和文件名
                        //contextResponse.AppendHeader("Content-Length", content.Length.ToString());
                        contextResponse.ContentEncoding = Encoding.Default;
                        contextResponse.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。 

                        book.Properties.Author = "盈泓";
                        Worksheet sheet = book[0];
                        sheet.Name = "账单";

                        // and this too...
                        sheet.PrintOptions.Orientation = PageOrientation.Landscape;
                        sheet.PrintOptions.SetMargins(0.5, 0.4, 0.5, 0.4);

                        AlignmentOptions al = new AlignmentOptions();
                        al.Vertical = VerticalAlignment.Center;



                        AlignmentOptions al1 = new AlignmentOptions();
                        al1.Vertical = VerticalAlignment.Center;
                        al1.Horizontal = HorizontalAlignment.Center;

                        XmlStyle style = new XmlStyle();
                        style.Font.Size = 12;
                        style.Font.Name = "宋体";
                        style.Alignment = al;

                        XmlStyle style21 = new XmlStyle();
                        style21.Font.Size = 26;
                        style21.Font.Name = "隶书";
                        style21.Alignment = al1;


                        XmlStyle style22 = new XmlStyle();
                        style22.Font.Size = 14;
                        style22.Font.Name = "华文新魏";
                        style22.Alignment = al1;
                        style22.Font.Bold = true;

                        XmlStyle style23 = new XmlStyle();
                        style23.Font.Size = 9;
                        style23.Font.Name = "宋体";
                        style23.Alignment = al1;

                        XmlStyle style24 = new XmlStyle();
                        style24.Font.Size = 15;
                        style24.Font.Name = "宋体";
                        style24.Alignment = al1;
                        style22.Font.Bold = true;

                        XmlStyle style28 = new XmlStyle();
                        style28.Font.Size = 13;
                        style28.Font.Name = "宋体";
                        style28.Alignment = al1;
                        style28.Font.Bold = true;
                        style28.Border.Weight = 1;
                        style28.Border.LineStyle = Borderline.Continuous;
                        style28.Border.Sides = BorderSides.All;

                        XmlStyle style29 = new XmlStyle();
                        style29.Border.Weight = 1;
                        style29.Border.LineStyle = Borderline.Continuous;
                        style29.Border.Sides = BorderSides.All;

                        XmlStyle style30 = new XmlStyle();
                        style30.Border.Weight = 1;
                        style30.Border.LineStyle = Borderline.Continuous;
                        style30.Border.Sides = BorderSides.All;
                        style30.DisplayFormat = DisplayFormatType.ShortDate;

                        XmlStyle style31 = new XmlStyle();
                        style31.Alignment.Vertical = VerticalAlignment.Center;
                        style31.Alignment.WrapText = true;
                        style31.Border.Weight = 1;
                        style31.Border.LineStyle = Borderline.Continuous;
                        style31.Border.Sides = BorderSides.All;

                        XmlStyle style35 = new XmlStyle();
                        style35.Alignment = al1;
                        style35.Font.Size = 12;
                        style35.Font.Name = "宋体";
                        style35.Font.Bold = true;

                        XmlStyle style36 = new XmlStyle();
                        style36.Alignment.Vertical = VerticalAlignment.Center;
                        style36.Alignment.Horizontal = HorizontalAlignment.Center;
                        style36.Alignment.WrapText = true;
                        style36.Font.Size = 12;
                        style36.Font.Name = "宋体";
                        style36.Font.Bold = true;

                        XmlStyle style37 = new XmlStyle();
                        style37.Alignment = al1;
                        style37.Font.Size = 12;
                        style37.Font.Name = "宋体";
                        style37.Font.Bold = true;
                        style37.DisplayFormat = DisplayFormatType.ShortDate;

                        XmlStyle style39 = new XmlStyle();
                        style39.Alignment = al1;
                        style39.Font.Size = 30;
                        style39.Font.Name = "宋体";
                        style39.Font.Bold = true;

                        XmlStyle style40 = new XmlStyle();
                        style40.Alignment = al1;
                        style40.Font.Size = 15;
                        style40.Font.Name = "黑体";
                        style40.Font.Bold = true;

                        XmlStyle style42 = new XmlStyle();
                        style42.Alignment.Horizontal = HorizontalAlignment.Left;
                        style42.Alignment.Vertical = VerticalAlignment.Center;
                        style42.Font.Size = 12;
                        style42.Font.Name = "宋体";
                        style42.Font.Bold = true;

                        sheet[0, 0].Value = "广州市科洋货运代理有限公司";
                        sheet[0, 0].Style = style39;
                        sheet[0, 0].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[0, 0], sheet[8, 0]).Merge();

                        sheet[0, 1].Value = "Guangzhou Keyang Transportation Agency Co.Ltd.";
                        sheet[0, 1].Style = style40;
                        sheet[0, 1].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[0, 1], sheet[8, 1]).Merge();

                        sheet[0, 2].Value = "账单明细";
                        sheet[0, 2].Style = style24;
                        sheet[0, 2].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[0, 2], sheet[8, 2]).Merge();

                        string targetName = string.Empty;
                        if (feeType == EnumCommon.FeeType.应收)
                        {
                            TB_Clients client = BaseDataProxy.GetClient(target);
                            targetName = client.fullName;
                        }
                        else
                        {
                            TB_Options o = BaseDataProxy.GetOption(target);
                            targetName = o.name;
                        }
                        sheet[0, 3].Value = "致：" + targetName;
                        sheet[0, 3].Style = style42;
                        sheet[0, 3].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[0, 3], sheet[8, 3]).Merge();

                        int sumIndex = 0;
                        //组织列头
                        for (int i = 0; i < dt.Columns.Count; i++)
                        {
                            if (dt.Columns[i].ColumnName == "总额")
                                sumIndex = i;
                            sheet[i, 4].Value = dt.Columns[i].Caption;
                            sheet[i, 4].Style = style28;
                            sheet[i, 4].DisplayFormat = DisplayFormatType.Text;
                        }
                        int currentRow = 5;
                        decimal totalAmount = 0;

                        //加载表数据
                        for (int r = 0; r < dt.Rows.Count; r++)
                        {
                            int row = currentRow + r;
                            for (int c = 0; c < dt.Rows.Count; c++)
                            {
                                sheet[c, row].Value = dt.Rows[r][c];
                                if (dt.Columns[c].ColumnName == "装货日期")
                                {
                                    sheet[c, row].Style = style30;
                                    sheet[c, row].DisplayFormat = DisplayFormatType.Custom;
                                    sheet[c, row].CustomFormatString = "yyyy-MM-dd hh:mm";
                                }
                                else if (dt.Columns[c].ColumnName == "费用")
                                {
                                    sheet[c, row].Style = style31;
                                    sheet[c, row].DisplayFormat = DisplayFormatType.Text;
                                    if (!WebCommon.IsCellNull(sheet[c, row].Value))
                                        totalAmount += Convert.ToDecimal(sheet[c, row].Value);
                                }
                                else if (dt.Columns[c].ColumnName == "总额")
                                {

                                    sheet[c, row].Style = style29;
                                    sheet[c, row].DisplayFormat = DisplayFormatType.Custom;
                                    sheet[c, row].CustomFormatString = "N2";

                                }
                                else
                                {
                                    sheet[c, row].Style = style29;
                                    sheet[c, row].DisplayFormat = DisplayFormatType.Text;
                                }
                            }
                        }
                        currentRow += dt.Rows.Count;
                        sheet[0, currentRow].Value = "总计：";
                        sheet[0, currentRow].Style = style28;
                        sheet[0, currentRow].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[0, currentRow], sheet[6, currentRow]).Merge();

                        currentRow += 1;
                        sheet[dt.Columns.Count - 2, currentRow].Value = FormulaHelper.Formula("sum", new Range(sheet[sumIndex, 5], sheet[sumIndex, 4 + dt.Rows.Count]));
                        sheet[dt.Columns.Count - 2, currentRow].Style = style28;
                        sheet[dt.Columns.Count - 2, currentRow].DisplayFormat = DisplayFormatType.Custom;
                        sheet[dt.Columns.Count - 2, currentRow].CustomFormatString = "N2";

                        currentRow += 1;
                        sheet[0, currentRow].Value = "开户行：中国工商银行-黄埔大道西支行";
                        sheet[0, currentRow].Style = style35;
                        sheet[0, currentRow].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[0, currentRow], sheet[3, currentRow]).Merge();

                        sheet[0, currentRow].Value = "请贵公司在收到账单后3个工作日内确认费用，否则当作默认处理。";
                        sheet[0, currentRow].Style = style36;
                        sheet[0, currentRow].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[0, currentRow], sheet[4, currentRow + 4]).Merge();

                        currentRow += 1;
                        sheet[0, currentRow].Value = "卡号：6222 0236 0204 0740 607";
                        sheet[0, currentRow].Style = style35;
                        sheet[0, currentRow].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[0, currentRow], sheet[3, currentRow]).Merge();

                        currentRow += 1;
                        sheet[0, currentRow].Value = "用户名：黄绍官";
                        sheet[0, currentRow].Style = style35;
                        sheet[0, currentRow].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[0, currentRow], sheet[3, currentRow]).Merge();

                        currentRow += 1;
                        sheet[0, currentRow].Value = "（如需要其它帐号，请看第二页的银行帐号）";
                        sheet[0, currentRow].Style = style35;
                        sheet[0, currentRow].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[0, currentRow], sheet[3, currentRow]).Merge();

                        currentRow += 1;
                        sheet[0, currentRow].Value = "如费用无误请尽快付款，谢谢！付款时，麻烦给予水单，方便销账！顺祝商祺！";
                        sheet[0, currentRow].Style = style36;
                        sheet[0, currentRow].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[0, currentRow], sheet[3, currentRow + 5]).Merge();

                        sheet[4, currentRow].Value = "制单人：黄先生/marco";
                        sheet[4, currentRow].Style = style35;
                        sheet[4, currentRow].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[4, currentRow], sheet[8, currentRow]).Merge();

                        currentRow += 1;
                        sheet[4, currentRow].Value = "电话：020-28945185";
                        sheet[4, currentRow].Style = style35;
                        sheet[4, currentRow].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[4, currentRow], sheet[8, currentRow]).Merge();

                        currentRow += 1;
                        sheet[4, currentRow].Value = "传真：020-89718757";
                        sheet[4, currentRow].Style = style35;
                        sheet[4, currentRow].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[4, currentRow], sheet[8, currentRow]).Merge();

                        currentRow += 2;
                        sheet[4, currentRow].Value = "广州市科洋货运代理财务部";
                        sheet[4, currentRow].Style = style35;
                        sheet[4, currentRow].DisplayFormat = DisplayFormatType.Text;
                        new Range(sheet[4, currentRow], sheet[8, currentRow]).Merge();

                        currentRow += 1;
                        sheet[4, currentRow].Value = DateTime.Now;
                        sheet[4, currentRow].Style = style35;
                        sheet[4, currentRow].DisplayFormat = DisplayFormatType.Custom;
                        sheet[4, currentRow].CustomFormatString = "yyyy-MM-dd";
                        new Range(sheet[4, currentRow], sheet[8, currentRow]).Merge();

                        Worksheet sheet1 = book[1];
                        sheet1.Name = "账号";
                        sheet[0, 0].Value = "广州市科洋货运代理有限公司";
                        sheet[0, 0].Style = style21;
                        sheet[0, 0].DisplayFormat = DisplayFormatType.Text;

                        sheet[0, 1].Value = "Guangzhou Keyang Transportation Agency Co.,Ltd.";
                        sheet[0, 1].Style = style22;
                        sheet[0, 1].DisplayFormat = DisplayFormatType.Text;

                        sheet[0, 2].Value = "电话Tel: 020-28945185，传真Fax:020-89718757";
                        sheet[0, 2].Style = style23;
                        sheet[0, 2].DisplayFormat = DisplayFormatType.Text;

                        sheet[0, 3].Value = "地址Add：广州市黄埔区黄埔东路5号东盛国际1616室";
                        sheet[0, 3].Style = style23;
                        sheet[0, 3].DisplayFormat = DisplayFormatType.Text;

                        sheet[0, 4].Value = "开户行:中国工商银行-黄埔大道西支行";
                        sheet[0, 4].Style = style24;
                        sheet[0, 4].DisplayFormat = DisplayFormatType.Text;

                        sheet[0, 5].Value = "卡号:6222 0236 0204 0740 607";
                        sheet[0, 5].Style = style24;
                        sheet[0, 5].DisplayFormat = DisplayFormatType.Text;

                        sheet[0, 6].Value = "用户名:黄绍官";
                        sheet[0, 6].Style = style24;
                        sheet[0, 6].DisplayFormat = DisplayFormatType.Text;

                        sheet[0, 7].Value = "开户行:中国银行-广州港湾路支行";
                        sheet[0, 7].Style = style24;
                        sheet[0, 7].DisplayFormat = DisplayFormatType.Text;

                        sheet[0, 8].Value = "卡号:6216 6119 0000 1711 702";
                        sheet[0, 8].Style = style24;
                        sheet[0, 8].DisplayFormat = DisplayFormatType.Text;

                        sheet[0, 9].Value = "用户名:黄绍官";
                        sheet[0, 9].Style = style24;
                        sheet[0, 9].DisplayFormat = DisplayFormatType.Text;

                        sheet[0, 10].Value = "开户行:中国农业银行-黄埔支行";
                        sheet[0, 10].Style = style24;
                        sheet[0, 10].DisplayFormat = DisplayFormatType.Text;

                        sheet[0, 11].Value = "卡号:6228 4800 8410 1257 115";
                        sheet[0, 11].Style = style24;
                        sheet[0, 11].DisplayFormat = DisplayFormatType.Text;

                        sheet[0, 12].Value = "用户名:黄绍官";
                        sheet[0, 12].Style = style24;
                        sheet[0, 12].DisplayFormat = DisplayFormatType.Text;

                        book.Export(contextResponse.OutputStream);
                    }
                }
                BaseDataProxy.Close();
            }
            catch (Exception ex) { throw ex; }

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
